package com.upay.android.util.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.upay.android.R;

import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;

public class PropertyLoader {

	/* ---- Class Variables ---- */
	private static Properties properties = null;

	private static void loadProperties(Resources resources) {
		try {
			InputStream rawResource = resources.openRawResource(R.raw.environment);
			properties = new Properties();
			properties.load(rawResource);
		} catch (NotFoundException e) {

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static String getProperty(String key, Resources resources) {
		if (properties == null) { 
			loadProperties(resources);
		}
		return properties.getProperty(key);
	}
	
}
